package com.zb.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zb.annotation.ListPattern;
import com.zb.annotation.NumberPattern;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.Date;
import java.util.List;

/**
 * @Author WEN
 * @Date 2024/2/4 0004
 **/
@Data
@ApiModel("SLA对象")
public class WorkSlaVo {
    @ApiModelProperty(value = "SLA ID，新增不必传，修改必传")
    private Long id;

    @NotBlank(message = "SLA名称不能为空")
    @Length(max = 20, message = "SLA名称长度限制20个字符以内")
    @ApiModelProperty(value = "SLA名称", required = true)
    private String name;

    @NotNull(message = "生效时间不能为空")
    @NumberPattern(regexp = "^(1|2)$", message = "生效时间类型参数不合法")
    @ApiModelProperty(value = "生效时间类型：1-全天，2-时间范围", required = true, example = "1")
    private Integer dateType;

    @JsonFormat(pattern = "HH:mm")
    @ApiModelProperty(value = "生效开始时间，当date_type=2时生效")
    private Date startTime;

    @JsonFormat(pattern = "HH:mm")
    @ApiModelProperty(value = "生效结束时间，当date_type=2时生效")
    private Date endTime;

    @NotNull(message = "提醒方式不能为空")
    @NotEmpty(message = "提醒方式不能为空")
    @Size(min = 1, message = "提醒方式至少选择一种")
    @ListPattern(regexp = {"1", "2", "3"}, required = true, message = "提醒方式参数不合法")
    @ApiModelProperty(value = "提醒方式：1-系统消息，2-微信，3-短信，支持多选", required = true, example = "['3']")
    private List<String> remindMode;

    @NotNull(message = "SLA状态不能为空")
    @ApiModelProperty(value = "SLA状态：false-启用，true-禁用", required = true, example = "false")
    private Boolean status;

    @Length(max = 200, message = "描述长度限制200个字符以内")
    @ApiModelProperty(value = "备注描述")
    private String remark;

    @NotNull(message = "适用模块参数参数不能为空")
    @Size(min = 1, message = "适用模块至少选择一个模块")
    @ApiModelProperty(value = "模块ID集合", required = true)
    private List<Long> moduleIds;

    @Valid
    @NotNull(message = "slaSLA触发条件不能为空")
    @Size(min = 1, message = "SLA触发条件至少填写一条")
    @ApiModelProperty(value = "SLA触发条件集合对象")
    private List<WorkSlaConditionVo> slaConditionVos;

}
